package cn.krui.helper;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.data.redis.core.StringRedisTemplate;

import cn.krui.helper.tools.RedisUtils;

/**
 * @author zc
 */
@Configuration
public class RedisConfig {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @Value("${spring.redis.prefix:qr:}")
    private String spring_redis_prefix;
    
    @Bean
    @Scope("prototype")
    public RedisUtils redisUtils() {
        return new RedisUtils(redisTemplate, spring_redis_prefix);
    }
}